package ao.com.bna.beans;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="RECURSO")
public class Recurso implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="ID_RECURSO_GENERATOR", sequenceName="RECURSO_SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="ID_RECURSO_GENERATOR")
	
	@Column(nullable = false, precision = 6)
	private Long idRecurso;
	
	@Temporal(TemporalType.DATE)
	private Date dataDespachoGov;
	
	@Temporal(TemporalType.DATE)
	private Date dataSancao;
	
	@ManyToOne
	@JoinColumn(name = "IDPROCESSO", referencedColumnName = "IDPROCESSO")
	private Processo processo = new Processo() ;

	
	
	
	public Long getIdRecurso() {
		return idRecurso;
	}

	public void setIdRecurso(Long idRecurso) {
		this.idRecurso = idRecurso;
	}

	public Date getDataDespachoGov() {
		return dataDespachoGov;
	}

	public void setDataDespachoGov(Date dataDespachoGov) {
		this.dataDespachoGov = dataDespachoGov;
	}

	public Date getDataSancao() {
		return dataSancao;
	}

	public void setDataSancao(Date dataSancao) {
		this.dataSancao = dataSancao;
	}

	public Processo getProcesso() {
		return processo;
	}

	public void setProcesso(Processo processo) {
		this.processo = processo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((idRecurso == null) ? 0 : idRecurso.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Recurso other = (Recurso) obj;
		if (idRecurso == null) {
			if (other.idRecurso != null)
				return false;
		} else if (!idRecurso.equals(other.idRecurso))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "Recurso [idRecurso=" + idRecurso + "]";
	}
	
	
	
}
